package com.pl.itsense.gwt.clientzone.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;
import com.pl.itsense.gwt.clientzone.model.MemberDTO;
import com.pl.itsense.gwt.clientzone.ui.LoginPanel;
import com.pl.itsense.gwt.clientzone.ui.RegisterPanel;
import com.pl.itsense.gwt.clientzone.ui.WorkspacePanel;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.util.KeyCallback;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;

public class Clientzone implements EntryPoint {
	
	
	private static int appState = 0;
	public static MemberDTO memberDTO = null;
	public static final ClientZoneServiceAsync clientZoneService = GWT.create(ClientZoneService.class);
	
	public void onModuleLoad() {
		setApplicationState(0);
		
	}
	
	public static void setApplicationState(int state){
		int prevState = appState;
		switch(state){
 			case 0: // login Panel
				if (prevState == 1) 	RegisterPanel.hideInstance();
				if (prevState == 2 )	WorkspacePanel.hideInstance();
				memberDTO = null;
				LoginPanel.showInstance();
				
				break;
			case 1: // register Panel
				if (prevState == 0)	LoginPanel.hideInstance();
				RegisterPanel.showInstance();
				break;
			case 2: // workspace Panel
				if (prevState == 0) LoginPanel.hideInstance();
				if (prevState == 1) RegisterPanel.hideInstance();
				WorkspacePanel.showInstance();
		};
		appState = state;
		
	}
	
}
